<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>登录-管理后台</title>
	<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="/assets/admin/css/main.css">

	<!-- 
	<link rel="stylesheet" href="/assets/select2/css/select2.min.css">
	<link rel="stylesheet" href="/assets/jedate/skin/jedate.css">
	<link rel="stylesheet" href="/assets/umeditor/themes/default/_css/umeditor.css"> -->
</head>
<body>
	<div id="login-container" class="gradient">
		<div class="login-box-body form">
			<div class="form-group">
				<span class="glyphicon glyphicon-user"></span>
				<input type="text" id="login-username" name="username" placeholder="账号 / Account">
			</div>
			<div class="form-group">
				<span class="glyphicon glyphicon-lock"></span>
				<input type="password" id="login-password" name="password" placeholder="密码 / Password">
			</div>
			<div>
				<button class="btn-form-submit" id="login-submit">Login</button>
			</div>
		</div>
	</div>
</body>
</html>

<script type="text/javascript" src="/assets/jquery.min.js"></script><!-- 
<script type="text/javascript" src="/assets/bootstrap/js/bootstrap.min.js"></script> -->
<script type="text/javascript">
	$('#login-submit').on('click',function(){
		if($(this).text() != 'Login'){
			return;
		}

		if(!$('#login-username').val()){
			alert('请填写您的账号!');
			return;
		}

		if(!$('#login-password').val()){
			alert('请填写您的密码！');
			return;
		}

		$(this).text('Login...');
		$.post('/admin/auth/check', {account: $('#login-username').val(),'password':$('#login-password').val()}, function(data) {
			$('#login-submit').text('Login');
			var json = $.parseJSON(data);

			if(json.code == 1){
				alert(json.msg);
				return;
			}else{
				//alert('登录成功');
				window.location = '/admin/';
			}
		});

	});
</script>
